<?php

namespace app\miniprogram\controller;

use app\common\tool\Wechat;

/**
 * 商户接口
 */
class Merchant extends Base
{
    public function test() {
        $data = [
            'sub_mch_name' => '子商户名称',
            'sub_mch_shortname' => '子商户简称',
            'service_phone' => '服务电话',
            'contact' => [
                'contact_name' => '联系人姓名',
                'contact_id_number' => '联系人身份证号码',
                'contact_mobile' => '联系人手机号码',
                'contact_email' => '联系人邮箱',
            ],
            'business_info' => [
                'merchant_type' => 'MERCHANT_TYPE_ENTERPRISE', // 商户类型
                'business_license_info' => [
                    'license_number' => '营业执照注册号',
                    'merchant_name' => '营业执照商户名称',
                    'legal_person' => '法定代表人姓名',
                    'license_period_begin' => '营业执照有效期开始时间',
                    'license_period_end' => '营业执照有效期结束时间',
                ],
            ],
            'settlement_info' => [
                'settlement_id' => '结算银行账户 ID',
                'account_type' => 'ACCOUNT_TYPE_BUSINESS', // 账户类型
                'account_bank' => '开户银行',
                'bank_address_code' => '开户银行省市编码',
                'bank_name' => '开户银行全称（含支行）',
                'account_number' => '银行账号',
            ]
        ];
        $app = Wechat::miniprogram();
        $result = $app->ecommerce->applyment->create($data);
        var_dump($result);
    } 
}
